package com.distribute.framework.core.web.util.sign;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import com.distribute.framework.core.web.util.JSEncode;
import com.distribute.framework.core.web.helper.Utils;

public class SignCreater {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		
		String thisPath = SignCreater.class.getResource("SignCreater.class").getPath();
		if(thisPath.startsWith("/"))thisPath = thisPath.substring(1);
		String projPath = null;
		try {
			projPath = URLDecoder.decode(thisPath.substring(0, thisPath.indexOf("WebRoot/WEB-INF/")),"UTF-8");
		} catch (UnsupportedEncodingException e2) {
			e2.printStackTrace();
		}
		
		String jsContent = Utils.readFile(SignCreater.class.getResourceAsStream("sign.js"), Utils.UTF8);
		String encodeJS = JSEncode.encode(jsContent, "E", true); 
		Utils.writeFile(projPath+"src/com/lazy3q/web/util/sign/sign.ucmis.js", encodeJS, Utils.UTF8);
		

	}

}